package com.trkj.pojos;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;

/**
 * The persistent class for the MEDCINE_TYPE database table.
 * 
 */
@Entity
@Table(name = "MEDCINE_TYPE")
@NamedQuery(name = "MedcineType.findAll", query = "SELECT m FROM MedcineType m")
public class MedcineType implements Serializable {
	private static final long serialVersionUID = 1L;

	public MedcineType(String medcinetypeEffect, String medcineTypeName, String medcinetypeNote) {
		super();
		this.medcinetypeEffect = medcinetypeEffect;
		this.medcineTypeName = medcineTypeName;
		this.medcinetypeNote = medcinetypeNote;
	}

	@Id
	@Column(name = "MEDCINETYPE_ID")
	@SequenceGenerator(initialValue=100,allocationSize=1,name="MEDCINETYPE_ID_GENERATOR", sequenceName="SEQID")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="MEDCINETYPE_ID_GENERATOR")
	private long medcinetypeId;

	@Column(name = "MEDCINETYPE_EFFECT")
	private String medcinetypeEffect;

	@Column(name = "MEDCINETYPE_NAME")
	private String medcineTypeName;

	public MedcineType(long medcinetypeId, String medcinetypeEffect, String medcineTypeName, String medcinetypeNote) {
		super();
		this.medcinetypeId = medcinetypeId;
		this.medcinetypeEffect = medcinetypeEffect;
		this.medcineTypeName = medcineTypeName;
		this.medcinetypeNote = medcinetypeNote;
	}

	@Column(name = "MEDCINETYPE_NOTE")
	private String medcinetypeNote;

	// bi-directional many-to-one association to MedcineDetail
	@OneToMany(mappedBy = "medcineType")
	private List<MedcineDetail> medcineDetails;

	public long getMedcinetypeId() {
		return this.medcinetypeId;
	}

	public MedcineType(String medcineTypeName) {
		super();
		this.medcineTypeName = medcineTypeName;
	}

	public void setMedcinetypeId(long medcinetypeId) {
		this.medcinetypeId = medcinetypeId;
	}

	public String getMedcinetypeEffect() {
		return this.medcinetypeEffect;
	}

	public void setMedcinetypeEffect(String medcinetypeEffect) {
		this.medcinetypeEffect = medcinetypeEffect;
	}

	

	public String getMedcineTypeName() {
		return medcineTypeName;
	}

	public void setMedcineTypeName(String medcineTypeName) {
		this.medcineTypeName = medcineTypeName;
	}

	public String getMedcinetypeNote() {
		return this.medcinetypeNote;
	}

	public void setMedcinetypeNote(String medcinetypeNote) {
		this.medcinetypeNote = medcinetypeNote;
	}

	public List<MedcineDetail> getMedcineDetails() {
		return this.medcineDetails;
	}

	public void setMedcineDetails(List<MedcineDetail> medcineDetails) {
		this.medcineDetails = medcineDetails;
	}

	public MedcineType() {
		super();
		// TODO Auto-generated constructor stub
	}

	public MedcineDetail addMedcineDetail(MedcineDetail medcineDetail) {
		getMedcineDetails().add(medcineDetail);
		medcineDetail.setMedcineType(this);

		return medcineDetail;
	}

	public MedcineDetail removeMedcineDetail(MedcineDetail medcineDetail) {
		getMedcineDetails().remove(medcineDetail);
		medcineDetail.setMedcineType(null);

		return medcineDetail;
	}

}